package com.mindata.blockmanager.bean;

/**
 * @author wuweifeng wrote on 2017/10/23.
 */
public class ResultGenerator {
    private static final String DEFAULT_SUCCESS_MESSAGE = "SUCCESS";
    private static final String SUCCESS_CODE = "200";
    private static final String FAIL_CODE = "400";

    public static BaseData genSuccessResult() {
        return new BaseData()
                .setCode(String.valueOf(SUCCESS_CODE))
                .setMessage(DEFAULT_SUCCESS_MESSAGE);
    }

    public static BaseData genSuccessResult(Object data) {
        return new BaseData()
                .setCode(String.valueOf(SUCCESS_CODE))
                .setMessage(DEFAULT_SUCCESS_MESSAGE)
                .setData(data);
    }

    public static BaseData genSuccessResult(String msg) {
        return new BaseData()
                .setCode(String.valueOf(SUCCESS_CODE))
                .setMessage(msg);
    }

    public static BaseData genFailResult(String message) {
        return new BaseData()
                .setCode(String.valueOf(FAIL_CODE))
                .setMessage(message);
    }

    public static BaseData genFailResult(String resultCode, String message) {
        return new BaseData()
                .setCode(resultCode)
                .setMessage(message);
    }
}
